<?php
	include_once('class/manajemententangkami.php');
	
	$abouts=new Tentangkami();
	
	$data=$abouts->getAllTentangkami();
	
	//print_r($data);

	if(isset($_POST['submit_tentangkami'])){
		include_once('class/manajemententangkami.php');
		$tentangkami=new Tentangkami();
		$developer= $_POST['developer'];
		$telp=$_POST['telp'];
		$email=$_POST['email'];
		$fax=$_POST['fax'];
		$lokasi = $_POST['lokasi_kantor'];
		$ket = $_POST['ket'];
		
				
		//gambar
		$fileName = $_FILES['gb_kami']['name'];
		$tmpName = $_FILES['gb_kami']['tmp_name'];
		$fileSize = $_FILES['gb_kami']['size'];
		$fileType = $_FILES['gb_kami']['type'];
		
		if(empty($tentangkami) || empty($developer))
		{
			$error_tentangkami="Tidak boleh Kosong";
		}
		 
		elseif(empty($fileName))
		{
			$error_foto="upload Foto";
		}
		else
		{
			
			$fp = fopen($tmpName, 'r');
			$gb_kami = fread($fp, filesize($tmpName));
			$gb_kami = addslashes($gb_kami);
			fclose($fp);
										
			$insert=$tentangkami->tambahTentangkami($developer, $telp, $email, $fax, $lokasi, $ket, $gb_kami);
			if($insert==1)
			{
				$success_upload_tentangkami="Tentang Kami sukses diupload";
			}
			else
			{
				$error_upload_tentangkami="Gagal upload Tentang Kami";
			}
		}
			
	}
?>